<script setup>
import { Search } from '@element-plus/icons-vue'
import { useSubjectStore } from '@/stores'
import { ref } from 'vue'
const subjectStore = useSubjectStore()
subjectStore.getFllow()
const search = ref('')
const loading = ref(false)
const is = ref(true)
is.value = subjectStore.is
</script>
<template template>
  <div v-if="!is">
    <el-input
      style="width: 200px; margin-right: 10px"
      v-model="search"
      :prefix-icon="Search"
    ></el-input>
    <el-button @click="addsearch(search)">搜索</el-button>
  </div>
  <el-card class="page-container">
    <div v-if="is" class="header">
      <span>受试者信息</span>
      <div>
        <el-input
          style="width: 200px; margin-right: 10px"
          v-model="search"
          :prefix-icon="Search"
        ></el-input>
        <el-button @click="addsearch(search)">搜索</el-button>
      </div>
    </div>
    <div v-if="!is">
      <el-button
        @click="issubject === true ? (issubject = false) : (issubject = true)"
      >
        添加
      </el-button>
    </div>
    <el-table :data="[1]" v-if="issubject">
      <el-table-column>
        <template #default>
          <el-input v-model="subject.name" />
        </template>
      </el-table-column>
    </el-table>
    <el-table
      v-loading="loading"
      @row-click="setId"
      :data="subjectStore.fllow"
      stripe
    >
      <el-table-column prop="name" label="姓名" />
      <el-table-column prop="date" label="随访时间" />
      <el-table-column prop="id" label="身份证" />
      <el-table-column prop="phone" label="电话" />
      <el-table-column prop="address" label="家庭地址" />
      <el-table-column prop="contactName" label="联系人姓名" />
      <el-table-column prop="contactPhone" label="联系人电话" />
      <el-table-column label="编辑">
        <el-link
          :underline="false"
          @click="general = true"
          style="margin-right: 10px"
          >详细信息</el-link
        >
        <el-link :underline="false" @click="annex = true">附件</el-link>
      </el-table-column>
    </el-table>
  </el-card>
</template>
